package com.woniuxy.portal.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.woniuxy.portal.entity.Address;
import com.woniuxy.portal.mapper.AddressMapper;
import com.woniuxy.portal.service.IAddressService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 作者
 * @since 2023-09-15
 */
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {

    @Override
    public List<Address> findAddressByUserId(int userId) {
        return this.list(Wrappers.lambdaQuery(Address.class)
                .eq(Objects.nonNull(userId), Address::getUserId,userId));
    }
}
